package com.atguigu.gmall.item.feign;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.vo.CategoryView;
import com.atguigu.gmall.product.entity.SkuImage;
import com.atguigu.gmall.product.entity.SkuInfo;
import com.atguigu.gmall.product.entity.SpuSaleAttr;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;

@RequestMapping("/api/inner/rpc/product")
@FeignClient("service-product")
public interface SkuFeignClient {

    //查询sku_info
    @GetMapping("/skuinfo/{skuId}")
    Result<SkuInfo> getSkuInfo(@PathVariable("skuId")Long skuId);
    //查询所有图片
    @GetMapping("/skuinfo/images/{skuId}")
    Result<List<SkuImage>> getSkuImages(@PathVariable("skuId")Long skuId);
    //查询sku对应的spu定义的所有销售属性名和值
    @GetMapping("/skuinfo/spu/saleattrandvalue/{spuId}")
    Result<List<SpuSaleAttr>> getSpuSaleAttrAndValue(@PathVariable("spuId") Long spuId,
                                                     @RequestParam("skuId") Long skuId);
    //查询某个sku对应分类的完整路径
    @GetMapping("/skuinfo/categoryview/{c3Id}")
    Result<CategoryView> getSkuCategoryView(@PathVariable("c3Id")Long c3Id);
    //查询某个sku对应的spu定义的所有sku的销售属性值组合
    @GetMapping("/skuinfo/valuejson/{spuId}")
    Result<String> getSkuValueJson(@PathVariable("spuId")Long spuId);
    //商品详情页价格
    @GetMapping("/skuinfo/price/{skuId}")
    Result<BigDecimal> getSkuPrice(@PathVariable("skuId")Long skuId);
}
